package jmine.tec.web.wicket.component.menu.cfg;

/**
 * Base class for menu transformers
 * 
 * @author lundberg
 */
public abstract class AbstractMenuTransformer extends AbstractMenuConfigFactoryBean {

    private final MenuConfig menuConfig;

    /**
     * Constructor
     * 
     * @param menuConfig menuConfig
     */
    public AbstractMenuTransformer(MenuConfig menuConfig) {
        super();
        this.menuConfig = menuConfig;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected final MenuConfig createMenuConfig() {
        this.transform(this.menuConfig);
        return this.menuConfig;
    }

    /**
     * Transforms the given menu, changing it according to the application's needs.
     * 
     * @param menu menu
     */
    protected abstract void transform(MenuConfig menu);

}
